<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('区域')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-area-add">

        <input type="hidden" id="pid" name="pid" th:value="${id}">

        <div class="form-group">
            <label class="col-sm-3 control-label">区域名称：</label>
            <div class="col-sm-8">
                <input name="title" class="form-control" type="text" required>
            </div>
        </div>







        <!--<div class="form-group">
            <label class="col-sm-3 control-label">名称：</label>
            <div class="col-sm-8">
                <input name="title" class="form-control" type="text">
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">描述：</label>
            <div class="col-sm-8">
                <textarea name="brief" class="form-control"></textarea>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">图片：</label>
            <div class="col-sm-8">
                <textarea name="img" class="form-control"></textarea>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">内容：</label>
            <div class="col-sm-8">
                <textarea name="content" class="form-control"></textarea>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">logo：</label>
            <div class="col-sm-8">
                <textarea name="logo" class="form-control"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">第三方标识：</label>
            <div class="col-sm-8">
                <input name="thirdMark" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">排序：</label>
            <div class="col-sm-8">
                <input name="display" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">发稿数量：</label>
            <div class="col-sm-8">
                <input name="articleNum" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动数量：</label>
            <div class="col-sm-8">
                <input name="activityNum" class="form-control" type="text">
            </div>
        </div>-->
    </form>
</div>


<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    var pid = $("#pid").val();
    var prefix = ctx + "system/area"


    function uploadFile() {
        var form = $("#form-area-add")[0];
        var formData = new FormData(form);
        var pid = $("#pid").val();
        formData.append('pid',pid);
        $.ajax({
            url: prefix + "/newCstAreaAdd",
            type: 'post',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            dataType: "json",
            success: function(result) {

                console.log(result)
                parent.location.reload();
            }
        });
    }


    $("#form-group-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            uploadFile();
        }
    }

    $("input[name='checkTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='addtime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>